<template>
  <div>
    <div style="display: none;">{dhsInfo.random_content}</div>
    <section class="mainmodule">
      <div class="mianad"
           v-if="dhsInfo.is_user_img">
        <div @click="openLink(dhsInfo.user_img_link)">
          <img v-if="dhsInfo.user_img_ggt"
               :src="dhsInfo.user_img_ggt"
               alt />
          <img v-else
               :src="dhsInfo.ad_img"
               alt />
        </div>
      </div>
      <div class="mainlist">
        <ul>
          <li v-if="dhsInfo.show_dh_inventory">
            <div @click="Jump('myStore')"
                 class="icon_xnkc">
              {{dhsInfo.ftitle_dhs_stock}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dhsInfo.show_dhs_share_card">
            <div @click="Jump('dhsCard')"
                 class="icon2_16">
              我的名片
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dhsInfo.show_dh_item">
            <div @click="Jump('dhsGoods')"
                 class="icon_dhsp">
              {{dhsInfo.ftitle_dhs_item}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dhsInfo.show_dh_purchase">
            <div @click="Jump('item-list')"
                 class="icon_wyjh">
              {{dhsInfo.ftitle_dhs_purchase}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dhsInfo.show_dh_purchase_order">
            <div @click="handleLinkTo('order-lists',{dhs_type:'1'})"
                 class="icon_wojhd">{{dhsInfo.ftitle_dhs_list}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_subcontractor">
            <div @click="Jump('nextLevelVender')"
                 class="icon_xjuser">{{dhsInfo.ftitle_dhs_user}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_subMembers">
            <div @click="Jump('nextLevelVenderUser')"
                 class="icon_wdmember">{{dhsInfo.ftitle_dhs_member}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dhs_teamOrder">
            <div @click="Jump('venderOrder')"
                 class="icon_tddd">{{dhsInfo.ftitle_dhs_order}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_virtualorder">
            <div @click="Jump('virtualVenderOrder')"
                 class="icon_xjdd">
              {{dhsInfo.ftitle_dhs_virtual_order}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.is_virtual_order_separate">
            <div @click="Jump('virtualVenderOrder',{'order_type':1})"
                 class="icon_lowerJhd">
              下级进货单
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          
          <li v-if="dhsInfo.is_virtual_order_separate">
            <div @click="Jump('virtualVenderOrder',{'order_type':2})"
                 class="icon_lowerFhd">
              下级发货单
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_my_delivery_order">
            <div @click="handleLinkTo('order-lists', {'is_dhs_delivery': 1})"
                 class="icon_myDeliveryOrder">
              我的出货单
              <span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_levelSubcontractor">
            <div @click="Jump('dhsRecommend')"
                 class="icon_tjlb">
              推荐列表
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_teamPerformance">
            <div @click="Jump('dhsYeJi', {dhsYjGoodsType: dhsInfo.dhs_yj_goods_type})"
                 class="icon_tdyj">
              团队业绩
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_superior && dhsInfo.superior_user">
            <div @click="Jump('director')"
                 class="icon_wdsj">
              {{dhsInfo.ftitle_superior}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dh_superior_orderer && dhsInfo.dhs_is_display">
            <div @click="handleLinkTo('parentInfo',{id:dhsInfo.dhs_parent_id,name:dhsInfo.user_dhs_info,type:'dhs',grade:dhsInfo.dhs_grade})"
                 class="icon_wdsja">
              {{dhsInfo.ftitle_dhs_superior}}
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.is_dhs_team_bonus">
            <div @click="Jump('dhsGlj')"
                 class="icon_tdglj">团队管理业绩<span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.is_dhs_allow_deposit">
            <div @click="Jump('dhsDeposit')"
                 class="icon_wdhk">我的预存款<span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.show_dhs_orderRanking">
            <div @click="Jump('DhsSalesSort')"
                 class="icon_cdlph">出单量排行<span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="!dhsInfo.is_app_open && dhsInfo.is_store_log && dhsInfo.show_dhs_myStore">
            <div @click="Jump('store')"
                 class="icon_dzd">{{dhsInfo.ftitle_store}}<span></span>
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="dhsInfo.dhs_team_order_sort">
            <div @click="Jump('dhsOrderRank')"
                 class="icon_cdlph">团队订单排行<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dhsInfo.show_dhs_entity_order">
            <div @click="handleLinkTo('dhsEntityOrder')"
                 class="icon_stkc">实体库存订单<span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 定制 苏州银丰 团队业绩 start -->
          <li  v-if="dzData.is_szyf_dz">
            <div @click="handleLinkTo('dhsGljDZ')"
                 class="icon_szyf">平级业绩<span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 定制 苏州银丰 团队业绩 end -->
          <!-- 定制 福萝拉 start -->
          <li v-if="dhsInfo.is_fll_dz == 1">
            <div @click="handleLinkTo('logsList')"
                 class="icon_cdlph">会员访问<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 福萝拉 end -->
          <!-- 定制 start -->
          <li v-if="dzData.is_yj">
            <div @click="handleLinkTo('virCommission')"
                 class="icon_tjlb">虚拟佣金<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dzData.is_yj || dzData.is_ltsn || isShowHangPlug">
            <div @click="handleLinkTo('holdOrder')"
                 class="icon_tjlb">挂起订单<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="dzData.is_yj">
            <div @click="handleLinkTo('virtualInventory')"
                 class="icon_tjlb">仓储明细<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 end -->
          <!-- 定制 哈多多  start -->
          <li v-if="dhsInfo.dhs_can_apply_upper_levels == 1">
            <div @click="JumpUrl('/User/dls_apply')"
                 class="icon_xgzl">升级申请<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 哈多多  end -->
          <!-- 定制 深圳市莱精选 start -->
          <!-- 莱特妮丝定制销售奖 -->
          <li v-if="dhsInfo.is_offline_sale_reward == 1">
            <div @click="Jump('dzDhsSaleReward')"
              class="icon_xsj">销售奖<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
           <!-- 定制 莱特妮思 订货商地址 start -->
          <li v-if="dzData.is_ltsn">
            <div @click="Jump('ltnsDhsAddress')"
              class="icon_dzgl">地址<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 莱特妮思 订货商地址 end -->
          <!-- 定制 莱特妮思 下级协议查询 start -->
          <li v-if="dzData.is_ltsn">
            <div @click="Jump('ltnsDhsxjSelect')"
              class="icon_tjlb">下级协议查询<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 莱特妮思 下级协议查询 end -->
          <!-- 定制 莱特妮思 退换货审核 start -->
          <li v-if="dzData.is_ltsn">
            <div @click="Jump('ltnsDhsthSH')"
              class="icon_xjdd">退换货审核<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 莱特妮思 退换货审核 end -->
          <!-- 定制 深圳市莱精选 end -->
          <!-- 定制 云集  start -->
          <li v-if="dhsInfo.yun_ji_top_dhs_dz == 1">
            <div @click="JumpUrl('https://cschat-ccs.aliyun.com/index.htm?tntInstId=_1vFJMIa&scene=SCE00007501')"
                 class="icon_kefu">客服<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 云集  end -->
          <!-- 定制 云集  start -->
          <li v-if="dhsInfo.is_yun_ji_dz == 1">
            <div @click="handleLinkTo('GrowUp')"
              class="icon_wdsj">育成人<span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 云集  end -->
          <!-- 定制 王学军 平级业绩统计 start -->
          <li v-if="dzData.is_jzx_multi_dhs_dz">
            <div @click="handleLinkTo('wxjPeerStatistics')"
                 class="icon_tdglj">平级业绩统计<span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 定制 王学军 平级业绩统计 end -->
          <!-- 层层报单 start -->
          <template>
            <li v-if="dzData.dz_is_show_purchase">
              <div @click="handleLinkTo('purchaseOrder',{type:0})"
                class="icon11_1_qmsc">进货单<span></span>
                <svg-icon icon-class="icon_right"
                  class="icon_right"></svg-icon>
              </div>
            </li>
            <li v-if="dzData.dz_is_show_my_purchase">
              <div @click="handleLinkTo('myPurchaseOrder',{type:1})"
                class="icon11_2_qmsc">我的进货单<span></span>
                <svg-icon icon-class="icon_right"
                  class="icon_right"></svg-icon>
              </div>
            </li>
            <li v-if="dzData.dz_is_show_lower_purchase">
              <div @click="handleLinkTo('myPurchaseOrder',{type:2})"
                class="icon11_3_qmsc">下级进货单<span></span>
                <svg-icon icon-class="icon_right"
                  class="icon_right"></svg-icon>
              </div>
            </li>
          </template>
          <!-- 层层报单 end -->
          <li v-if="dhsInfo.common_center_renovation_parameter.showShareLinkDhs">
            <div @click="handleLinkTo('shareSelect')"
                 class="icon20_1_fx">
              万能链接
              <span></span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 视频号数据 -->
          <li v-if="dhsInfo.show_video_num_data_dhs">
            <div @click="Jump('venderOrder', {type: 'live'})"
                 class="icon_sphsj">视频号数据
              <span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
        </ul>
        <ul v-if="dhsInfo.dataset_dhs && dhsInfo.dataset_dhs.length>0">
          <li v-for="(item,index) in dhsInfo.dataset_dhs"
              :key="index">
            <a @click="openLink(item.link)"
               class="custom_item"
               :style="{backgroundImage: 'url('+item.pic+')'}">
              {{item.showtitle}}
              <i class="icon-right"></i>
            </a>
          </li>
        </ul>
      </div>
    </section>
  </div>
</template>

<script>
import Vue from 'vue'
import { openPage } from '@/utils/utils.js'
import { getHangPlug } from '@/api/user/dhs/dhsApi'

export default Vue.extend({
  props: {
    dhsInfo: {
      type: Object
    },
    dzData: {
      type: Object
    }
  },
  data() {
    return {
      isShowHangPlug: false,
    }
  },
  created() {
    getHangPlug().then((res) => {
      if (res.status) {
        this.isShowHangPlug = res.data.is_show_hang_plun
      }
    })
  },
  methods: {
    // TODO 小程序跳转
    openLink(link) {
      openPage(link)
    },
    Jump(url, data) {
      // const data = { type }
      this.$JumpPath(this, url, data)
    },
    handleLinkTo(url, data) {
      // console.log(url, data, '小程序挂起订单')
      this.$JumpName(this, url, data)
    },
    JumpUrl(url, data) {
      window.location.href = url
    },
    _show_qrcode() {
      this.$emit('showQrcode')
    }
  }
})
</script>

<style lang="scss">
@import 'src/styles/user/index.scss';
</style>
